Pulse width modulators (PWMs) are useful for several applications including communications, control applications such as motor controllers, and the like. A PWM receives an input value and provides an output pulse whose duty cycle is determined by the input value. A typical PWM includes a counter which counts the number of cycles of a clock signal, an input register for storing the input value, and a comparator which detects when the counter reaches the input value and switches the output signal.
Because of their control applications, PWMs are frequently combined with data processors in a single integrated circuit. The PWM would be connected to an internal bus of the data processor. Typically, the PWM would be a memory-mapped peripheral, and the data processor would write the input number to the PWM using the internal bus.
Some data processors, however, operate on two's complement data. The twos complement numbering system is able to represent both positive and negative numbers. In the two's complement numbering system, the most significant bit is the sign bit, which is a zero to represent a positive number and a one to represent a negative number. The two's complement numbering system is especially useful for control applications to represent signed quantities. However, known PWMs are designed to operate on unsigned input numbers and would require additional circuitry to convert from two's complement to unsigned format. This conversion operation increases circuit size. What is needed, then, is a PWM which can accept two's complement input data and therefore accept the data directly from the data processors bus without a large amount of added circuit area.